/**
 * Lenovo Group
 * Copyright (c) 1999-2016 All Rights Reserved.
 */
package com.lenovo.lmrp.api.appgateway;

import java.util.List;
import java.util.Map;

import javax.ws.rs.GET;
import javax.ws.rs.POST;
import javax.ws.rs.PUT;
import javax.ws.rs.Path;
import javax.ws.rs.PathParam;

import com.lenovo.lmrp.api.model.RestResponse;
import com.lenovo.lmrp.api.model.view.EngineerPositionVO;
import com.lenovo.lmrp.api.model.view.EngineerRankingVO;
import com.lenovo.lmrp.api.model.view.EngineerVO;

/**
 * 
 * @author wujin
 * @version v1.0
 */
public interface IAppEngineer {

    /**
     * View engineer detail information
     * 
     * @param itsmcode      distinct ITSM system
     * @param engineerid    engineer ID
     * @return
     */
    @GET
    @Path("/{itsmcode}/engineers/{engineerid}")
    public RestResponse<EngineerVO> getEngineer(@PathParam("itsmcode") String itsmcode,
                                                @PathParam("engineerid") String engineerid);
    /**
     * Set engineer status, availabe value is 0- idel，1 - busy，2 - vacation
     * 
     * @param itsmcode      distinct ITSM system
     * @param engineerid
     * @param status
     * @return
     */
    @PUT
    @Path("/{itsmcode}/engineers/{engineerid}/status")
    public RestResponse<Integer> setEngineerStatus(@PathParam("itsmcode") String itsmcode,
                                                   @PathParam("engineerid") String engineerid,
                                                    int status);
    
    /**
     * change engineer properties, for example, email, phone
     * 
     * @param itsmcode      distinct ITSM system
     * @param engineerid
     * @param fields        changed fields map, key is engineer property name
     * @return
     */
    @PUT
    @Path("/{itsmcode}/engineers/{engineerid}")
    public RestResponse<Integer> setEngineerInfo(@PathParam("itsmcode") String itsmcode,
                                                 @PathParam("engineerid") String engineerid,
                                                 Map<String, String> fields);
    
    /**
     * User forget password, neet to reset password should get security code by through SMS
     * 
     * @param itsmcode      distinct ITSM system
     * @param loginName     user login name
     * @return
     */
    @GET
    @Path("/{itsmcode}/engineers/{loginname}/securitycode")
    public RestResponse<Integer> getSecurityCode(@PathParam("itsmcode") String itsmcode,
                                                 @PathParam("loginname") String loginName);
    
    /**
     * Submit reset password requistion
     * 
     * @param itsmcode      distinct ITSM system
     * @param loginName     user login name
     * @param securityCode  get from SMS, system will check whether is exist and expired
     * @return
     */
    @POST
    @Path("/{itsmcode}/engineers/password")
    public RestResponse<Integer> resetPassword(@PathParam("itsmcode") String itsmcode,
                                               String loginName,
                                               String securityCode);
    
    @POST
    @Path("/{itsmcode}/engineers/{engineerid}/position")
    public RestResponse<Integer> setEngineerPosition(@PathParam("itsmcode") String itsmcode,
                                                     @PathParam("engineerid") String engineerid,
                                                     EngineerPositionVO positionVO);
    /**
     * 工程师排名（超赞工单数）
     * @param itsmcode
     * @param fields
     *          period 时间 "2016-01"(by month) or "2016"(by year)
     * @return
     */
    @POST
    @Path("/{itsmcode}/engineers/{engineerid}/ranking")
    public RestResponse<List<EngineerRankingVO>> engineerRankingByEvaluate(@PathParam("itsmcode") String itsmcode,
            @PathParam("engineerid") String engineerid,
      Map<String,String> fields);
}
